router.js ➔ ... ➔ CommentRouter   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
/*
2
 * This file is part of Sulu.
3
 *
4
 * (c) MASSIVE ART WebServices GmbH
5
 *
6
 * This source file is subject to the MIT license that is bundled
7
 * with this source code in the file LICENSE.
8
 */
9
10
define(['services/husky/util', 'services/husky/mediator'], function(Util, Mediator) {
11
12
    'use strict';
13
14
    var instance = null,
15
16
        getInstance = function() {
17
            if (instance === null) {
18
                instance = new CommentRouter();
19
            }
20
21
            return instance;
22
        },
23
24
        navigate = function(route) {
25
            Mediator.emit('sulu.router.navigate', route, true, true);
26
        };
27
28
    /** @constructor **/
29
    function CommentRouter() {
30
    }
31
32
    CommentRouter.prototype = {
33
        toList: function() {
34
            navigate('comments');
35
        },
36
        toEdit: function(id, content) {
37
            navigate('comments/edit:' + id + '/' + (content || 'details'));
38
        }
39
    };
40
41
    return getInstance();
42
});
43